Package edu.uky.ai.lp.logic
Class Unifier
java.lang.Object
edu.uky.ai.lp.logic.Unifier
- All Implemented Interfaces:
java.lang.Cloneable
public class Unifier
extends java.lang.Object
implements java.lang.Cloneable
A unifier tracks which variable are equal to one another and which variable
are equal to constants.
- Author:
- Stephen G. Ware
-
Constructor Summary
Constructors Constructor Description Unifier()Constructs an empty unifier. -
Method Summary
Modifier and Type Method Description Unifierclone()Termget(Variable variable)Returns the value assigned to a variable (if any) under this unifier.Unifierset(Variable variable, Term value)Sets a variable equal to a value (if value is a constant) or as having the same value as another variable (if value is a variable).java.lang.StringtoString()
-
Constructor Details
-
Unifier
public Unifier()Constructs an empty unifier.
-
-
Method Details
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
clone
- Overrides:
clonein classjava.lang.Object
-
get
Returns the value assigned to a variable (if any) under this unifier.- Parameters:
variable- the variable- Returns:
- the value assigned to the variable (if any)
-
set
Sets a variable equal to a value (if value is a constant) or as having the same value as another variable (if value is a variable). Note that this object is not modified; a new unifier is returned.- Parameters:
variable- the variable to setvalue- the value to set it to- Returns:
- the resulting unifier, or null if the variable cannot be set to that value
-